import { axios } from '@/utils/request'

const api = {
  // 商品列表
  goodsList: '/cloud/supplier/goods-list',
  // 商品审核列表
  goodsAuditList: '/cloud/supplier/goods-audit-list',
  // 商品审核列表
  auditSubmit: '/cloud/supplier/audit-submit',
  // 添加商品
  addGood: '/cloud/supplier/set-goods',
  // 添加编辑商品规格
  editSku: '/cloud/supplier/set-goods-attr',
  // 上下架商品
  changeGoodStatus: '/cloud/supplier/set-goods-status',
  // 转单列表
  transOrderList: '/cloud/supplier/supplier-purchase-order-list',
  // 转单列表
  supplierSendTypeList: '/cloud/supplier/supplier-send-type-list',
  // 售后列表
  supplierSendTypeRefundList: '/cloud/supplier/supplier-send-type-refund-list',
  // 售后列表
  transOrderRefundList: '/cloud/supplier/supplier-purchase-order-refund-list',
  // 创建提现申请
  creatWithdrawAupply: '/cloud/supplier/set-supplier-cash',
  // 发货
  sendGoods: '/cloud/supplier/supplier-purchase-send',
  // 转单售后
  supplierApplyHandle: '/cloud/supplier/supplier-apply-handle',
  // 获取运费规则
  getPostage: '/cloud/supplier/supplier-get-rules',
  // 保存运费规则
  savePostage: '/cloud/supplier/set-rules',
  // 获取运费规则省市区
  getDistrict: '/setting/postage/district-info',
  // 余额变动记录
  banlanceRecord: '/cloud/supplier/supplier-get-balance-log',
  // 余额冻结记录
  supplierGetBalanceFrozenLog: '/cloud/supplier/supplier-get-balance-frozen-log',
  supplierPurchaseDel: 'cloud/supplier/supplier-purchase-del',

  // 转单导出
  purchaseOrderInfo: '/cloud/supplier/purchase-order-info',

  // 修改地址
  setAddress: '/cloud/supplier/supplier-purchase-order-set-address',
  // 云仓分类
  getGoodsCatList: '/cloud/platform/get-goods-cat-list',
  getKefuInfo: '/cloud/supplier/get-kefu-info',
  setKefuInfo: '/cloud/supplier/set-kefu-info',
  supplierGetRulesList: '/cloud/supplier/supplier-get-rules-list',
  supplierDelRules: '/cloud/supplier/supplier-del-rules',
  supplierSetStatus: '/cloud/supplier/supplier-set-status',
}

export default api

export function goodsList(parameter) {
  return axios({
    url: api.goodsList,
    method: 'post',
    data: parameter,
  })
}

export function goodsAuditList(data) {
  return axios({
    url: api.goodsAuditList,
    method: 'post',
    data,
  })
}

export function addGood(parameter) {
  return axios({
    url: api.addGood,
    method: 'post',
    data: parameter,
  })
}

export function editSku(parameter) {
  return axios({
    url: api.editSku,
    method: 'post',
    data: parameter,
  })
}
export function changeGoodStatus(parameter) {
  return axios({
    url: api.changeGoodStatus,
    method: 'post',
    data: parameter,
  })
}

export function transOrderList(parameter) {
  return axios({
    url: api.transOrderList,
    method: 'post',
    data: parameter,
  })
}

export function transOrderRefundList(parameter) {
  return axios({
    url: api.transOrderRefundList,
    method: 'post',
    data: parameter,
  })
}

export function creatWithdrawAupply(parameter) {
  return axios({
    url: api.creatWithdrawAupply,
    method: 'post',
    data: parameter,
  })
}

export function sendGoods(parameter) {
  return axios({
    url: api.sendGoods,
    method: 'post',
    data: parameter,
  })
}

export function getPostage(parameter) {
  return axios({
    url: api.getPostage,
    method: 'post',
    data: parameter,
  })
}

export function savePostage(parameter) {
  return axios({
    url: api.savePostage,
    method: 'post',
    data: parameter,
  })
}

export function getDistrict(parameter) {
  return axios({
    url: api.getDistrict,
    method: 'post',
    data: parameter,
  })
}

export function banlanceRecord(parameter) {
  return axios({
    url: api.banlanceRecord,
    method: 'post',
    data: parameter,
  })
}

export function supplierGetBalanceFrozenLog(data) {
  return axios({
    url: api.supplierGetBalanceFrozenLog,
    method: 'post',
    data,
  })
}

export function supplierApplyHandle(data) {
  return axios({
    url: api.supplierApplyHandle,
    method: 'post',
    data,
  })
}

export function auditSubmit(data) {
  return axios({
    url: api.auditSubmit,
    method: 'post',
    data,
  })
}

export function supplierPurchaseDel(data) {
  return axios({
    url: api.supplierPurchaseDel,
    method: 'post',
    data,
  })
}

export function purchaseOrderInfo() {
  return process.env.VUE_APP_API_BASE_URL + api.purchaseOrderInfo
}

export function setAddress(data) {
  return axios({
    url: api.setAddress,
    method: 'post',
    data,
  })
}

export function getGoodsCatList(params) {
  return axios({
    url: api.getGoodsCatList,
    method: 'get',
    params,
  })
}

// 集采start
export function agentOrderGroupList(params) {
  return axios({
    url: '/cloud/supplier/agent-order-group-list',
    method: 'get',
    params,
  })
}

export function agentOrderDistribution(data) {
  return axios({
    url: '/cloud/supplier/agent-order-distribution',
    method: 'post',
    data,
  })
}

export function agentOrderDistributionList(params) {
  return axios({
    url: '/cloud/supplier/agent-order-distribution-list',
    method: 'get',
    params,
  })
}

export function setDistributionStatus(data) {
  return axios({
    url: '/cloud/platform/set-distribution-status',
    method: 'post',
    data,
  })
}


export function setSortingStatus(data) {
  return axios({
    url: '/cloud/platform/set-sorting-status',
    method: 'post',
    data,
  })
}


export function getDistributionList(params) {
  return axios({
    url: '/cloud/merchant/get-distribution-list',
    method: 'get',
    params,
  })
}

export function merchantSetDistributionStatus(data) {
  return axios({
    url: '/cloud/merchant/set-distribution-status',
    method: 'post',
    data,
  })
}
// 集采end

export function getKefuInfo(parameter) {
  return axios({
    url: api.getKefuInfo,
    method: 'get',
    params: parameter,
  })
}

export function setKefuInfo(data) {
  return axios({
    url: api.setKefuInfo,
    method: 'post',
    data,
  })
}

export function supplierGetRulesList(data) {
  return axios({
    url: api.supplierGetRulesList,
    method: 'post',
    data,
  })
}

export function supplierGetRules(data) {
  return axios({
    url: api.supplierGetRules,
    method: 'post',
    data,
  })
}

export function supplierSetRules(data) {
  return axios({
    url: api.supplierSetRules,
    method: 'post',
    data,
  })
}

export function supplierDelRules(data) {
  return axios({
    url: api.supplierDelRules,
    method: 'post',
    data,
  })
}

export function supplierSetStatus(data) {
  return axios({
    url: api.supplierSetStatus,
    method: 'post',
    data,
  })
}

export function getUserLevel(params) {
  return axios({
    url: '/cloud/platform/get-user-level',
    method: 'get',
    params,
  })
}
export function setMchLevel(data) {
  return axios({
    url: '/cloud/platform/set-mch-level',
    method: 'post',
    data,
  })
}

export function getSortingOrder(params) {
  return axios({
    url: '/cloud/platform/get-sorting-order',
    method: 'get',
    params,
  })
}
